home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
edit
/
thedos20.zip
/
total.the
< prev
next >
Wrap
Text File
|
1995-01-26
|
1KB
|
50 lines
/*
$Id: TOTAL.THE 2.0 1995/01/26 16:34:42 MH Release MH $
*/
/***********************************************************************/
/* Description: REXX macro to sum numbers in a marked block. */
/* Syntax: total */
/* Notes: This macro will sum the numbers in the marked block */
/* and insert a new line with the total at the end of the */
/* block. */
/***********************************************************************/
Trace o
'EXTRACT /BLOCK/FNAME/FPATH/'
If block.0 = 1 Then Do
'EMSG No Marked block'
Return
End
If block.1 \= 'BOX' & block.1 \= 'COLUMN' Then Do
'EMSG No Marked BOX or COLUMN block'
Return
End
current_file = fpath.1||fname.1
If current_file \= block.6 Then Do
'EMSG Marked block not in current file'
Return
End
Do i = block.2 To block.4
'NOMSG :'||i
If rc = 0 Then Leave
End
tot. = 0
Do Forever
'EXTRACT /CURLINE/LINE/EOF'
If line.1 > block.4 Then Leave
If eof.1 = 'YES' Then Leave
num = Substr(curline.3,block.3,block.5-block.3+1)
Do i = 1 To Words(num)
If Datatype(Word(num,i),'NUM') Then tot.i = tot.i + Word(num,i)
End
if Words(num) > tot.0 Then tot.0 = Words(num)
'N'
End
'U'
line = ''
Do i = 1 To tot.0
line = line tot.i
End
'i' Copies(' ',block.3-1)||line
'N'
Return